import Vue from 'vue'
import VueRouter from 'vue-router'
import LoginView from '../views/LoginView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: LoginView,
  },
  {
    path: '/admin',
    redirect: '/admin/index',
    component: () => import('../views/HomeView.vue'),
    children: [
      {
        path: 'index', // /admin/index
        component: () => import('../views/AdminIndexView.vue')
      },
      {
        path: 'product/albums', // /admin/product/albums
        component: () => import('../views/product/AlbumListView.vue')
      },
      {
        path: 'product/attribute-templates', // /admin/product/attribute-templates
        component: () => import('../views/product/AttributeTemplateListView.vue')
      },
      {
        path: 'product/brands', // /admin/product/brands
        component: () => import('../views/product/BrandListView.vue')
      },
      {
        path: 'product/categories/add-new', // /admin/product/categories/add-new
        component: () => import('../views/product/CategoryAddNewView.vue')
      },
      {
        path: 'product/categories', // /admin/product/categories
        component: () => import('../views/product/CategoryListView.vue')
      },
      {
        path: 'product/spu/add-new', // /admin/product/spu/add-new
        component: () => import('../views/product/SpuAddNewView.vue')
      },
      {
        path: 'product/spu', // /admin/product/spu
        component: () => import('../views/product/SpuListView.vue')
      }
    ]
  }

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
